package com.ndp.fb.rdb.db.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.ndp.fb.rdb.api.DataPermissionRdbService;
import com.ndp.fb.rdb.db.DaoTemplate;

/**
 * Created by yeahmobi on 2015/6/8.
 */
@Service
public class DataPermissionRdbServiceImpl extends DaoTemplate implements DataPermissionRdbService {
    @Override
    public boolean userHasAccess(String userid,String table, String columnName, String values) {
        String sql="SELECT count(1) FROM "+table+" where user_id =? and "+columnName+"=?";
        Integer count = getJdbcTemplate().queryForInt(sql.toString(),userid,values);
        return count>0;
    }
}
